from functools import wraps

from flask import abort
from libs.hmac_header import verify_hmac_header

def hmac_verify(view):
    @wraps(view)
    def decorated(*args, **kwargs):
        if not verify_hmac_header():
            abort(401)
        return view(*args, **kwargs)

    return decorated
